import request from '@/config/axios'

export interface CustMgrVO {
  id: number
  customerName: string
  shortName: string
  contactPerson: string
  contactNumber: string
  creditCode: string
  province: number
  city: number
  county: number
  address: string
  businessLicense: string
  legalPersonIdFront: string
  legalPersonIdBack: string
}

// 查询客户管理列表
export const getCustMgrPage = async (params) => {
  return await request.get({ url: `/queue/cust-mgr/page`, params })
}

// 根据企业类型获得企业精简信息
export const getcarrierLists = (id) => {
  return request.get({ url: '/queue/cust-mgr/get-simple-list-by-type?enterpriseType='+id })
}

// 查询客户管理列表
export const getCustMgrPageSimple = async () => {
  return await request.get({ url: `/queue/cust-mgr/get-simple-list` })
}

// 查询客户管理详情
export const getCustMgr = async (id: number) => {
  return await request.get({ url: `/queue/cust-mgr/get?id=` + id })
}

// 新增客户管理
export const createCustMgr = async (data: CustMgrVO) => {
  return await request.post({ url: `/queue/cust-mgr/create`, data })
}

// 修改客户管理
export const updateCustMgr = async (data: CustMgrVO) => {
  return await request.put({ url: `/queue/cust-mgr/update`, data })
}

// 删除客户管理
export const deleteCustMgr = async (id: number) => {
  return await request.delete({ url: `/queue/cust-mgr/delete?id=` + id })
}

// 导出客户管理 Excel
export const exportCustMgr = async (params) => {
  return await request.download({ url: `/queue/cust-mgr/export-excel`, params })
}
